package com.yilin.tms.core.remote;

import com.yilin.tms.core.application.ReturnData;
import com.yilin.tms.core.commons.model.AuthData;
import com.yilin.tms.core.commons.annotation.NoLoginSecurity;
import com.yilin.tms.core.components.interceptor.ReqProviderInterceptor;
import com.yilin.tms.core.entity.data.statistics.*;
import com.yilin.tms.core.entity.data.statistics.user.HatchStatistics;
import com.yilin.tms.core.entity.data.statistics.user.ShipperStatistics;
import com.yilin.tms.core.entity.data.statistics.user.TruckerStatistics;
import com.yilin.tms.core.entity.data.statistics.user.UserStatistics;
import com.yilin.tms.core.entity.user.account.Account;
import com.yilin.tms.core.entity.user.account.UserAccrual;
import com.yilin.tms.core.entity.user.auth.*;
import com.yilin.tms.core.entity.user.hatch.*;
import com.yilin.tms.core.entity.user.organize.Cooperate;
import com.yilin.tms.core.entity.user.organize.MemberType;
import com.yilin.tms.core.entity.user.organize.Organize;
import com.yilin.tms.core.entity.user.technical.TechnicalFeeRule;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * 远程调用 用户服务
 *
 * @author zhangjinyuan
 * @date 2022/10/29
 */
@FeignClient(name = "user-service-provider", configuration = ReqProviderInterceptor.class)
public interface IUserRemote {

    /**
     * 根据ID获取用户信息
     */
    @PostMapping(value = "/user/account/getAccountById")
    @NoLoginSecurity
    ReturnData<Account> getAccountById(@RequestParam(value = "accountId") String accountId);

    /**
     * 根据用户KEY获取用户信息
     */
    @PostMapping(value = "/user/account/getAccountByApiKey")
    ReturnData<Account> getAccountByApiKey(@RequestParam(value = "apiKey") String apiKey);

    /**
     * 获取用户集合
     */
    @PostMapping(value = "/user/account/getAccountListByIds")
    @NoLoginSecurity
    ReturnData<List<Account>> getAccountListByIds(@RequestParam("accountIds") String accountIds);

    /**
     * 修改用户信息
     */
    @PostMapping(value = "/user/account/updateAccount")
    ReturnData<Object> updateAccount(@RequestBody Account account);

    /**
     * 信用评分
     * */
    @PostMapping(value = "/user/account/updateUserCredit")
    ReturnData<Object> updateUserCredit(@RequestParam("accountId")String accountId,@RequestParam("diffCredit") Double diffCredit,@RequestParam("reason") String reason);

    /**
     * 累计
     */
    @PostMapping(value = "/user/account/updateUserAccrual")
    ReturnData<Object> updateUserAccrual(@RequestParam("accountId")String accountId,@RequestBody UserAccrual userAccrual);

    /**
     * 获取系统顶级用户
     */
    @PostMapping(value = "/user/account/getSystemAdminUser")
    ReturnData<Account> getSystemAdminUser();

    /**
     * 获取系统顶级用户
     */
    @PostMapping(value = "/user/account/getSystemYilinUser")
    @NoLoginSecurity
    ReturnData<Account> getSystemYilinUser();

    /**
     * 获取平台未生成或生产失败的数据
     */
    @PostMapping(value = "/user/account/getErrorTmsAccount")
    ReturnData<List<Account>> getErrorTmsAccount(@RequestHeader("serviceSafeKey") String serviceSafeKey);

    //------------------------------------------------------------------------------------------------------------------

    /**
     * 根据组织ID获取组织信息
     */
    @PostMapping(value = "/user/organize/getOrganizeById")
    @NoLoginSecurity
    ReturnData<Organize> getOrganizeById(@RequestParam("organizeId") String organizeId);

    /**
     * 批量ID查询
     */
    @PostMapping(value = "/user/organize/getOrganizeListByIds")
    ReturnData<List<Organize>> getOrganizeListByIds(@RequestParam("organizeIds") String organizeIds);

    /**
     * 获取合作货主ID列表
     */
    @PostMapping(value = "/user/organize/getCooperateShipperIdList")
    ReturnData<List<String>> getCooperateShipperIdList(@RequestParam("organizeId") String organizeId);


    /**
     * 获取合作关系
     */
    @PostMapping(value = "/user/organize/getCooperate")
    ReturnData<Cooperate> getCooperate(@RequestParam("targetOrganizeId") String targetOrganizeId);



    //------------------------------------------------------------------------------------------------------------------

    /**
     * 获取驾驶证 详情
     */
    @PostMapping(value = "/user/auth/getDrivingLicenseByUserId")
    ReturnData<DrivingLicense> getDrivingLicenseByUserId(@RequestParam(value = "accountId") String accountId);

    /**
     * 获取用户身份证 详情
     */
    @PostMapping(value = "/user/auth/getIdCardByUserId")
    ReturnData<IdCard> getIdCardByUserId(@RequestParam(value = "accountId") String accountId);

    /**
     * 获取从业资格证 详情
     */
    @PostMapping(value = "/user/auth/getQualificationCertByUserId")
    ReturnData<QualificationCert> getQualificationCertByUserId(@RequestParam(value = "accountId") String accountId);

    /**
     * 获取印章 详情
     */
    @PostMapping(value = "/user/auth/getStampCompanySeal")
    ReturnData<StampCompanySeal> getStampCompanySeal(@RequestParam(value = "organizeId") String organizeId);

    /**
     * 微服务/APP-校验认证
     */
    @PostMapping(value = "/user/auth/checkAuthStatus")
    ReturnData<Object> checkAuthStatus(@RequestParam("accountId") String accountId, @RequestParam("authItems") AuthData.AuthItem[] authItems);

    /**
     * 获取营业执照 详情
     */
    @PostMapping(value = "/user/auth/getBusinessLicenseByOrganizeId")
    ReturnData<BusinessLicense> getBusinessLicenseByOrganizeId(@RequestParam("organizeId") String organizeId);

    /**
     * 获取道路经营许可证 详情
     */
    @PostMapping(value = "/user/auth/getTransLicenseByOrganizeId")
    ReturnData<TransBusinessLicense> getTransLicenseByOrganizeId(@RequestParam("organizeId") String organizeId);


    //------------------------------------------------------------------------------------------------------------------

    /**
     * 用户证件未认证统计
     */
    @PostMapping(value = "/user/statistics/getUserNoAuthStatistics")
    ReturnData<UserNoAuthStatistics> getUserNoAuthStatistics();

    /**
     * 获取货主统计数据
     */
    @PostMapping(value = "/user/statistics/getShipperStatistics")
    ReturnData<ShipperStatistics> getShipperStatistics();

    /**
     * 获取车主统计数据
     */
    @PostMapping(value = "/user/statistics/getTruckerStatistics")
    ReturnData<TruckerStatistics> getTruckerStatistics();

    /**
     * 获取用户统计数据
     */
    @PostMapping(value = "/user/statistics/getUserStatistics")
    ReturnData<UserStatistics> getUserStatistics();

    /**
     * 获取孵化统计数据
     */
    @PostMapping(value = "/user/statistics/getHatchStatistics")
    ReturnData<HatchStatistics> getHatchStatistics();


    //------------------------------------------------------------------------------------------------------------------
    /**
     * 获取我组织 会员
     */
    @PostMapping(value = "/user/memberType/getMyMemberTypeByOrganizeId")
    @NoLoginSecurity
    ReturnData<MemberType> getMyMemberTypeByOrganizeId(@RequestParam("organizeId") String organizeId);


    //------------------------------------------------------------------------------------------------------------------

    /**
     * 获取指定平台及车型计价规则
     */
    @PostMapping("/user/hatch/getCommTruckTypeRule")
    ReturnData<Map<String, Map<String, Object>>> getCommTruckTypeRule(@RequestParam("platId") String platId,
                                                                      @RequestParam("commTruckTypeId") String commTruckTypeId);

    /**
     * 获取平台百度OCR孵化配置
     */
    @PostMapping(value = "/user/hatch/getBaiduOcrHatch")
    ReturnData<HatchBaiduOcr> getBaiduOcrHatch(@RequestParam("platId") String platId);

    /**
     * 获取平台ETC孵化配置
     */
    @PostMapping(value = "/user/hatch/getEtcHatch")
    ReturnData<HatchEtc> getEtcHatch(@RequestParam(value = "platId") String platId);

    /**
     * 获取平台微信支付孵化配置
     */
    @PostMapping(value = "/user/hatch/getWechatHatch")
    ReturnData<HatchWechat> getWechatHatch(@RequestParam(value = "platId") String platId);

    /**
     * 获取平台孵化配置
     */
    @PostMapping(value = "/user/hatch/getAlipayHatch")
    ReturnData<HatchAlipay> getAlipayHatch(@RequestParam(value = "platId") String platId);

    /**
     * 获取平台高德孵化配置
     */
    @PostMapping(value = "/user/hatch/getGaodeMapHatch")
    @NoLoginSecurity
    ReturnData<HatchGaodeMap> getGaodeMapHatch(@RequestParam(value = "platId") String platId);

    /**
     * 获取HYB孵化配置
     */
    @PostMapping(value = "/user/hatch/getHybHatch")
    ReturnData<HatchHyb> getHybHatch(@RequestParam(value = "platId") String platId);

    /**
     * 获取平台Sms配置
     */
    @PostMapping(value = "/user/hatch/getSmsHatch")
    ReturnData<HatchSms> getSmsHatch(@RequestParam(value = "platId") String platId);

    /**
     * 获取平台Jpush配置
     */
    @PostMapping(value = "/user/hatch/getJpushHatch")
    ReturnData<HatchJpush> getJpushHatch(@RequestParam(value = "platId") String platId);

    /**
     * 获取平台参数接口孵化配置
     */
    @PostMapping(value = "/user/hatch/getPlatProductHatch")
    ReturnData<HatchPlatProduct> getPlatProductHatch(@RequestParam(value = "platId") String platId);
    /**
     * 获取平台参数接口孵化配置
     */
    @PostMapping(value = "/user/hatch/getPlatProductHatchByCode")
    @NoLoginSecurity
    ReturnData<HatchPlatProduct> getPlatProductHatchByCode(@RequestParam(value = "productCode") String productCode);

    //------------------------------------------------------------------------------------------------------------------

    /**
     * 获取指定平台及车型计价规则
     */
    @PostMapping("/user/fee/getTechnicalFeeRule")
    @NoLoginSecurity
    ReturnData<TechnicalFeeRule> getTechnicalFeeRule();

    /**
     * 获取功能查存
     */
    @PostMapping(value = "/user/grant/getMyMemberTypeConfig")
    ReturnData<MemberType> getMyMemberTypeConfig(@RequestParam(value = "organizeId") String organizeId);

    //------------------------------------------------------------------------------------------------------------------

    /**
     * 证件认证过期 每日监测任务
     * */
    @PostMapping(value = "/user/task/autoCertificatesOverdue")
    @NoLoginSecurity
    void autoCertificatesOverdue();

    /**
     * 账户安全密码隔日恢复服务
     * */
    @PostMapping(value = "/user/task/autoSetSafeDisabled")
    @NoLoginSecurity
    void autoSetSafeDisabled();

}
